package com.zy.qudadid.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.amap.api.services.core.PoiItem;
import com.zy.lcpassenger.R;
import com.zy.qudadid.presenter.IndexSelectaddsPresenter;
import com.zy.qudadid.ui.adapter.base.BaseAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by ninos on 2016/9/20.
 */
public class IndexSelectaddsAdapter extends BaseAdapter<IndexSelectaddsAdapter.VHolder, PoiItem, IndexSelectaddsPresenter> {

    public IndexSelectaddsAdapter(Context context, IndexSelectaddsPresenter indexSelectaddsPresenter, View header) {
        super(context, indexSelectaddsPresenter, header);
        isAddFooter = false;
    }

    public IndexSelectaddsAdapter(Context context, IndexSelectaddsPresenter indexSelectaddsPresenter) {
        super(context, indexSelectaddsPresenter);
        isAddFooter = false;
    }

    @Override
    public int provideItemLayoutId() {
        return R.layout.activity_index_selectadds_item;
    }

    @Override
    public VHolder createVH(ViewGroup parent, int viewType, View view) {
        return new VHolder(view);
    }

    @Override
    public void bindData(VHolder holder, int position) {
        PoiItem poiItem = data.get(position);
        holder.isi_address.setText(poiItem.getProvinceName()+poiItem.getCityName()+poiItem.getAdName());
        holder.isi_name.setText(poiItem.getTitle());
    }

    class VHolder extends RecyclerView.ViewHolder {

        @Nullable @Bind(R.id.isi_address)TextView isi_address;
        @Nullable @Bind(R.id.isi_name)TextView isi_name;

        VHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}